<!DOCTYPE html>
<html>
<head>
<title>编辑拼团商品</title>
#include("../../include/common.html")
</head>
<body class="gray-bg">
    <div class="wrapper wrapper-content">
        <div class="ibox float-e-margins">
            <div class="ibox-title">
                <h5>编辑拼团商品</h5>
            </div>
           <form id="inputForm" action="update" method="post">
           		<input type="hidden" name="id" value="#(groupProduct.id)">
           		<input type="hidden" name="groupId" value="#(groupProduct.groupId)">
	            <div class="ibox-content">
	                <div class="form-horizontal clearfix">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">拼团人数：</label>
                            <div class="col-sm-3">
                                <input class="form-control" type="text" name="num" value="#(groupProduct.num)">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">拼团价格：</label>
                            <div class="col-sm-3">
                                <input class="form-control" type="text" name="price" value="#(groupProduct.price)">
                            </div>
                        </div>
                        <div class="form-group">
                      		<div class="row">
	                            <label class="col-sm-3 control-label">选择商品：</label>
	                            <div class="col-sm-3">
	                            	<input type="hidden" name="productId" id="productId" value="#(groupProduct.productId)" /> 
	                                <input class="form-control" type="text" id="productName" value="#(groupProduct.product.name)" readonly="readonly">
	                            </div>
	                            <div class="col-sm-2">
	                            	<button type="button" class="btn btn-primary" style="" id="chooseProduct">选择</button>
	                            </div>
                            </div>
                      	</div>
	                </div>
	            </div>
	            <div class="modal-footer col-sm-3 col-sm-offset-2">
	                <button type="submit" class="btn btn-w-m btn-primary">确定</button>
	                <button type="button" class="btn btn-w-m btn-default" onclick="history.back(); return false;">取消</button>
	            </div>
            </form>
        </div>
    </div>
</body>
</html>
<script type="text/javascript">

function chooseProductCall(productId,productName){
	$("#productId").val(productId);
	$("#productName").val(productName);
}

$("#chooseProduct").click(function(){
	$.dialog({ width: '950px',
	    height: 500,
	    content: 'url:#(base)/admin/product/choose'});
});

$().ready(function() {

	var $inputForm = $("#inputForm");
    
    // 表单验证
    $inputForm.validate({
        rules: {
            num: {
            	required: true,
                digits: true
            },
            price:"required"
        }
    });

});
</script>
